package com.ruoyi.web.controller.statistic;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.statistic.UserVo;
import com.ruoyi.system.domain.statistic.UserVo2;
import com.ruoyi.system.service.StatisticService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 进行统计分的controller
 */
@RestController
@RequestMapping("/statistic")
public class StatisticController {

    @Resource
    private StatisticService statisticService;

    /**
     * 统计各岗位的人数
     * @param
     * @return
     */

    @GetMapping("/countUserByPost")
    public AjaxResult countUserByPost(){

        UserVo userVo = statisticService.countUserByPost();

        return AjaxResult.success(userVo);
    }


    /**
     * 统计各角色的人数
     * @param
     * @return
     */
    @GetMapping("/countUserByRole")
    public AjaxResult countUserByRole(){

        List<UserVo2> userVo2s = statisticService.countUserByRole();

        return AjaxResult.success(userVo2s);
    }




}
